#:kivy 1.0.9
#:import DisableableButton ui.disableable_button.DisableableButton
#:import FittableLabel ui.fittable_widgets.FittableLabel

<AddWords>:
    word_list: wlist
    word_input: input
    add_word_but: add_word_but
    add_dict_but: add_dict_but
    next_butt: next_butt

    id: root_widget
    orientation: 'vertical'
    BoxLayout:
        orientation: 'horizontal'
        size_hint_y: None
        height: root.height*0.1
        Button:
            color: 1,0,0,1
            text: _('Back')
            on_release: root.go_back()
        DisableableButton:
            id: next_butt
            text: root.next_button_text
            on_release: root.finish()
    BoxLayout:
        orientation: 'horizontal'
        size_hint_y: 0.1
        TextInput:
            size_hint_x: None
            width: root.width - 50
            id: input
            multiline: False
            on_text_validate: root.add_user_word(input)
            font_size: 0.6 * self.height
            on_text: root.plus_butt_up(args[1])
        DisableableButton:
            id: add_word_but
            size_hint_x: None
            width: 50
            text: '+'
            on_release: root.add_user_word(input)
    BoxLayout:
        orientation: 'horizontal'
        size_hint_y: 0.1
        DisableableButton:
            size_hint_x: 1
            id: add_dict_but
            text: _('From dictionary')
            on_release: root.from_dict()
    ScrollView:
        do_scroll_x: False
        size_hint_y: 1
        WordList:
            parent: root_widget
            id: wlist

<WordList>:
    size_hint_y: None
    cols: 1
    id: scroll

<ListElement>:
    word: ''
    rows: 1
    size_hint_y: None
    height: min(self.size[0]*0.2,50)
    FittableLabel:
        length: max(len(self.parent.word),1)
        fit_height: True
        size_hint_x: None
        height: self.parent.height
        width: root.width - btn.width
        id: word_label
        text: root.word
    Button:
        id: btn
        height: self.parent.height
        size_hint_x: None
        width: self.height
        font_size: self.height*0.7
        text: '-'
        on_release: root.parent.parent.del_word(root)
